home *** CD-ROM | disk | FTP | other *** search
/ IRIX 6.5 Applications 2004 April / SGI IRIX 6.5 Applications 2004 April.iso / dist / appletalk.idb / usr / etc / appletalk / getpreview.z / getpreview
Text File  |  2002-03-07  |  2KB  |  67 lines

  1. #!/bin/csh -f
  2. #    @(#)getpreview    10.1    99/10/14    Xinet, Inc.
  3. #    Copyright (c) 1998 by Xinet, Inc.  All Rights Reserved.
  4. # xkspool RIP script that finds "Preview" programs on the local machine
  5. # wherever they might live.
  6. #
  7. set op = list
  8. set item = ""
  9. if ($#argv > 0) then
  10.     if ("$1" == get) then
  11.         set op = get
  12.         if ($#argv < 2) exit 1
  13.         set item = "$2"
  14.     else if ("$1" == ppd) then
  15.         set op = ppd
  16.         if ($#argv < 2) exit 1
  17.         set item = "$2"
  18.     else if ("$1" != list) then
  19.         exit 1
  20.     endif
  21. endif
  22.  
  23. set rips = ( showps ghostview pageview xpsview )
  24. set names = ( "SGI Screen Preview" "GhostScript" "SUN Screen Preview" "SGI Display Preview" )
  25. set ppds = ( XPSVIEW2.PPD GS.PPD SPARC.PPD XPSVIEW.PPD )
  26. set ripopt = ( "-igc -" - "-timeout 120 -" "-igc -" )
  27. set nonomatch
  28. set dirlist = ( /usr/bin/X11 /usr/X*/bin /usr/openwin/bin /usr/bin \
  29.         /usr/local/bin /usr/local /usr/new /usr/etc/appletalk /usr/freeware/bin )
  30.  
  31. set f = 1
  32. while ($f <= $#rips)
  33.     if ($op != list) then
  34.         if ("$names[$f]" != "$item") then
  35.             @ f = $f + 1
  36.             continue
  37.         endif
  38.         if ($op == ppd) then
  39.             if (-r /usr/adm/appletalk/ppds/$ppds[$f]) then
  40.                 echo /usr/adm/appletalk/ppds/$ppds[$f]
  41.             endif
  42.             exit 0
  43.         endif
  44.     endif
  45.     set d = 0
  46.     if ($?gotshowps && "$rips[$f]" == "xpsview") then
  47.         @ f = $f + 1
  48.         continue
  49.     endif
  50.     while ($d <= $#dirlist)
  51.         if (-x "$dirlist[$d]/$rips[$f]") then
  52.             if ($op == get) then
  53.                 echo "$dirlist[$d]/$rips[$f] $ripopt[$f]"
  54.                 exit 0
  55.             endif
  56.             echo cmd:$names[$f]
  57.             if ("$rips[$f]" == "showps") set gotshowps = 1
  58.             break
  59.         endif
  60.         @ d = $d + 1
  61.     end
  62.     if ($op != list) exit 1
  63.     @ f = $f + 1
  64. end
  65. if ($op != list) exit 1
  66. exit 0
  67.